<?php
/**
 * XmlGraph.php
 * 
 * @category   Naneau
 * @package    Naneau_View_Helper
 * @copyright  Copyright (c) 2007 Maurice Fonk - http://naneau.nl
 * @version    0.1
 */

/**
 * Naneau_View_Helper_XmlGraph
 * 
 * helper for xml graphs
 *
 * @category   Naneau
 * @package    Naneau_View_Helper
 * @copyright  Copyright (c) 2007 Maurice Fonk - http://naneau.nl
 */
class Naneau_View_Helper_XmlGraph {

    /**
     * view object
     *
     * @var Zend_View
     */
    private $_view;

    /**
     * setter method for view
     *
     * @param unknown_type $view
     */
    public function setView($view) {
        $this->_view = $view;
    }

    /**
     * helper function
     *
     * @param string $dataUrl
     * @return string
     */
    public function xmlGraph($dataUrl) {
        $graphUrl = $this->_view->staticFile('swf/charts.swf');
        $graphUrl .= '?library_path=' . $this->_view->staticFile('swf/charts_library');
        $graphUrl .= '&amp;xml_source=' . $dataUrl;

        $html = '<div class="graph">';
        $html .= '<object class="graph" type="application/x-shockwave-flash" data="' . $graphUrl . '">';
        $html .= '<param name="movie" value="' . $graphUrl . '" />';
        $html .= '<param name="quality" value="High" />';
        $html .= '</object>';
        $html .= '</div>';
        return $html;
    }
}